<template>
  <div class="Toast">
    <i
      :class="
        type == 'success'
          ? 'icon-toast_chenggong'
          : type == 'warning'
          ? 'icon-toast-jinggao'
          : 'icon-toast-shibai_huaban'
      "
      class="iconfont"
    ></i>
    <span>{{ msg }}</span>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState({
      msg: (state) => state.ToastStatus.msg,
      type: (state) => state.ToastStatus.type,
    }),
  },
};
</script>

<style lang="less" scoped>
.Toast {
  position: fixed;
  left: 50%;
  top: 0px;
  transform: translate(-50%);
  background-color: #fff;
  border-radius: 5px;
  color: #000;
  padding: 10px 20px;
  box-shadow: 0 0 12px rgb(251, 207, 207);
  i {
    margin-right: 5px;
  }

  .icon-toast-shibai_huaban {
    color: red;
  }
  .icon-toast_chenggong {
    color: green;
  }
  .icon-toast-jinggao {
    color: orange;
  }
}
</style>